package org.dromara.common.core.utils;

/**
 * @Author: Stars
 * @Date: 2025/3/9 18:19
 */
public class IdGenerator {

    private static SnowflakeIdGenerator WORKER = new SnowflakeIdGenerator(1, 1);

    /***
     * 获取long类型的 id
     * @return
     */
    public static long getId() {
        return WORKER.nextId();
    }

    /****
     * 获取String类型的 id
     * @return
     */
    public static String getIdStr() {
        return String.valueOf(WORKER.nextId());
    }

    /***
     * 测试
     * @param args
     */
    public static void main(String[] args) {
        //生成100000个id
        for (int i =0 ;i<100000;i++){
            long id = getId();
            System.out.println(id);
        }

        System.out.println("************************************");

        System.out.println(getIdStr());
    }
}
